package com.d0325.homework;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Scanner;

public class BirthTest {
    public static void main(String[] args) {
        ArrayList<Long> arrayList = new ArrayList<>();
        String[] a = new String[5];
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入五个出生日期，格式：2020-03-25");
        for (int i = 0; i < 5; i++) {
            try {
                a[i] = sc.nextLine();
                //获取当前时间得毫秒数
                Long nowtimes = System.currentTimeMillis();
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                Date date = sdf.parse(a[i]);
                Long oldtime = date.getTime();
                long day = (nowtimes - oldtime) / 1000 / 60 / 60 / 24;
                arrayList.add(day);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        for (int i = 0; i < 5; i++) {
            System.out.println("来到这个世界"+arrayList.get(i)+"天");
        }
    }
}
